<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>rotate</title>
<link type="text/css" rel="stylesheet" href="main.css">
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="rotate.js"></script>
<script type="text/javascript" src="index.js"></script>
</head>
<body >
<div class="rotateBox">
    <div class="J_Poster poster-main" data-setting='{"width":1000,"height":360,"posterWidth":640,"posterHeight":360,"autoPlay":true,"delay":2500,"speed":500}'>
        <div class="poster-btn poster-prev-btn"></div>
        <ul class="poster-list">
            <li class="poster-item"><img src="1.jpg" width="100%" height="100%" ></li>
            <li class="poster-item"><img src="2.jpg" width="100%" height="100%" ></li>
            <li class="poster-item"><img src="3.jpg" width="100%" height="100%" ></li>
            <li class="poster-item"><img src="4.jpg" width="100%" height="100%" ></li>
            <li class="poster-item"><img src="5.jpg" width="100%" height="100%" ></li>
            <li class="poster-item"><img src="6.jpg" width="100%" height="100%" ></li>
        </ul>
        <div class="poster-btn poster-next-btn"></div>
    </div>
    <div class="inputHtml">
        <div >请输入网址：</div><input id="url_in" placeholder="请输入网址" class="newinput"></input>
        <div >获取图片几张：</div><input id="countLI" class="newinput" ></input>
    </div>
    <div class="inputHtml">
        <button class="add_pic">获取</button>
        <button class="remove_pic">还原</button>
    </div>
</div>
</body>
<script>
    //添加按钮
    $(".add_pic").click(function () {
        //验证url合理性
        let Url = $('#url_in').val();
        const pattern = RegExp('\\b(([\\w-]+://?|www[.])[^\\s()<>]+(?:[\\w\\d]+|([^[:punct:]\\s]|/)))');
        let flag = pattern.test(Url);
        //选择插入几张（countLi)图片
        let countLi = $('#countLI').val();
        if(flag){
            localStorage.setItem("newPoster",countLi);
            localStorage.setItem("URL",Url);
            window.location.reload();
        }else{
            window.location.reload();
        };
    });
    $(".remove_pic").click(function () {
        localStorage.clear();
        window.location.reload();
    })
    //https://carw.vincicar.com/vb/asset/wp_list?callback=fun
</script>
</html>


